﻿<%@ Page Title="" Language="C#" MasterPageFile="~/TP3Master.master" AutoEventWireup="true"
    CodeFile="frmRegistroProgramacion.aspx.cs" Inherits="Espectaculos_Gestion_frmRegistroProgramacion" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <table class="tablaForm" align="center">
        <tr>
            <td align="left" class="filaCab">
                <asp:Label ID="lblTituloProg" runat="server" Text="Registro de Espectáculo" Font-Size="Larger"></asp:Label>
            </td>
        </tr>
        <tr>
            <td align="center">
                <br />
                <br />
                <table cellpadding="0" cellspacing="0" border="0" align="center">
                    <tr>
                        <td align="center" colspan="3">
                            <asp:Label ID="lblMensaje" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            Espectáculo :
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtnombre" runat="server" Width="200px"></asp:TextBox>
                        </td>
                        <td align="left">
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Ingrese un nombre de espectáculo."
                                ControlToValidate="txtnombre" Display="Static" ValidationGroup="grabarProg">*</asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" valign="top">
                            Descripción :
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtDescripcion" runat="server" Width="200px" MaxLength="2000" Rows="3"
                                TextMode="MultiLine"></asp:TextBox>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            Fecha :
                        </td>
                        <td align="left">
                            <asp:Label ID="lblFecha" runat="server" Font-Bold="true"></asp:Label>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            Local :
                        </td>
                        <td align="left">
                            <asp:Label ID="lblLocal" runat="server" Font-Bold="true"></asp:Label>
                        </td>
                        <td>
                            <asp:HiddenField ID="hdIdLocal" runat="server" Value="0" />
                            <asp:HiddenField ID="hdIdEspectaculo" runat="server" Value="0" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            Estado :
                        </td>
                        <td align="left">
                            <asp:DropDownList ID="ddlEstado" runat="server">
                            </asp:DropDownList>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td align="right">
                            <asp:Button ID="ibtnGrabar" runat="server" ValidationGroup="grabarProg" Text="Grabar"
                                OnClick="ibtnGrabar_Click" />
                        </td>
                        <td>
                            <asp:Button ID="btnCancelar" runat="server" Text="Cancelar" OnClick="btnCancelar_Click" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td align="center">
                <br />
                <asp:Panel ID="pnlEspecArts" runat="server" Width="100%">
                    <table cellspacing="0" cellpadding="0" border="0" width="100%">
                        <tr style="height: 25px">
                            <td align="left" style="background-color: #748A37; color: #dde4ec;">
                                <b>&nbsp; &nbsp;Artista</b>
                            </td>
                            <td align="right" style="background-color: #748A37; color: #dde4ec;">
                                <asp:Label ID="Label1" runat="server" Text="(Mostrar...)"></asp:Label>
                                <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/botones/expand.jpg" AlternateText="(Mostrar detalle...)" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
                <asp:Panel ID="pnlEspecArtsBody" runat="server" Width="100%">
                    <table cellspacing="2" cellpadding="2" border="0" width="100%">
                        <tr>
                            <td align="center">
                                <table cellpadding="0" cellspacing="0" border="0" align="center">
                                    <tr>
                                        <td align="right">
                                            Artista :
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtArtista" runat="server"></asp:TextBox>
                                            <asp:HiddenField ID="hdIdArtista" runat="server" />
                                             <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtArtista"
                                                ErrorMessage="Seleccione un artista." ValidationGroup="agregarArt">*</asp:RequiredFieldValidator>
                                        </td>
                                        
                                        <td>
                                            <asp:ImageButton ID="imgBuscarArtista" runat="server" ToolTip="Buscar Artista"
                                                ImageUrl="~/Espectaculos/Images/botones/zoom.gif" 
                                                onclick="imgBuscarArtista_Click" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            Hora inicio :
                                        </td>
                                        <td align="left">
                                            <asp:DropDownList ID="ddlHora" runat="server">
                                            </asp:DropDownList>
                                            :
                                            <asp:DropDownList ID="ddlMinuto" runat="server">
                                            </asp:DropDownList>
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            Duración en horas :
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtDuracion" runat="server" ValidationGroup="agregarArt" Width="80px"></asp:TextBox>
                                            <asp:FilteredTextBoxExtender ID="txtDuracion_FilteredTextBoxExtender" runat="server"
                                                Enabled="True" FilterType="Numbers" TargetControlID="txtDuracion">
                                            </asp:FilteredTextBoxExtender>
                                            <asp:RequiredFieldValidator ID="rfvDur" runat="server" ControlToValidate="txtDuracion"
                                                ErrorMessage="Ingrese la duración." ValidationGroup="agregarArt">*</asp:RequiredFieldValidator>
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            &nbsp;
                                        </td>
                                        <td align="right">
                                            <asp:Button ID="btnAgregarArt" runat="server" OnClick="btnAgregarArt_Click" Text="Agregar Artista"
                                                ValidationGroup="agregarArt" />
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                </table>
                                <asp:UpdatePanel ID="upnlArt" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <asp:GridView ID="grvArtista" runat="server" BackColor="White" AutoGenerateColumns="False"
                                            BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" OnRowDataBound="grvArtista_RowDataBound"
                                            DataKeyNames="IdEspectaculo,IdArtista">
                                            <Columns>
                                                <asp:BoundField DataField="Nombre" HeaderText="Artista" />
                                                <asp:BoundField DataField="SubTipo" HeaderText="Género" />
                                                <asp:BoundField DataField="HoraInicio" HeaderText="Hora" DataFormatString="{0:t}"
                                                    HtmlEncode="false" />
                                                <asp:BoundField DataField="Duracion" HeaderText="Duración" />
                                                <asp:TemplateField>
                                                    <ItemTemplate>
                                                        <asp:ImageButton ID="ibtnEliminarArt" runat="server" ImageUrl="~/Images/botones/filedelete.gif"
                                                            OnClick="ibtnEliminarArt_Click" />
                                                        <asp:ConfirmButtonExtender ID="ibtnEliminarArt_ConfirmButtonExtender" runat="server"
                                                            ConfirmText="Está seguro de eliminar el registro?" Enabled="True" TargetControlID="ibtnEliminarArt">
                                                        </asp:ConfirmButtonExtender>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                            </Columns>
                                            <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
                                            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
                                            <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                                            <RowStyle BackColor="White" ForeColor="#330099" />
                                            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
                                            <SortedAscendingCellStyle BackColor="#FEFCEB" />
                                            <SortedAscendingHeaderStyle BackColor="#AF0101" />
                                            <SortedDescendingCellStyle BackColor="#F6F0C0" />
                                            <SortedDescendingHeaderStyle BackColor="#7E0000" />
                                        </asp:GridView>
                                    </ContentTemplate>
                                    <Triggers>
                                        <asp:AsyncPostBackTrigger ControlID="btnAgregarArt" EventName="Click" />
                                        <asp:AsyncPostBackTrigger ControlID="grvArtista" EventName="RowCommand" />
                                    </Triggers>
                                </asp:UpdatePanel>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
                <asp:CollapsiblePanelExtender ID="cpeArts" runat="server" TargetControlID="pnlEspecArtsBody"
                    ExpandControlID="pnlEspecArts" CollapseControlID="pnlEspecArts" Collapsed="True"
                    TextLabelID="Label1" ImageControlID="Image1" ExpandedText="(Ocultar...)" CollapsedText="(Mostrar...)"
                    CollapsedImage="~/Images/Botones/expand.jpg" ExpandedImage="~/Images/Botones/collapse.jpg"
                    SuppressPostBack="true" BehaviorID="pnlEspecArtsBody">
                </asp:CollapsiblePanelExtender>
                <br />
            </td>
        </tr>
        <tr>
            <td align="center">
                <br />
                <asp:Panel ID="pnlReq" runat="server" Width="100%">
                    <table cellspacing="0" cellpadding="0" border="0" width="100%">
                        <tr style="height: 25px">
                            <td align="left" style="background-color: #748A37; color: #dde4ec;">
                                <b>&nbsp; &nbsp;Requisitos</b>
                            </td>
                            <td align="right" style="background-color: #748A37; color: #dde4ec;">
                                <asp:Label ID="Label2" runat="server" Text="(Mostrar...)"></asp:Label>
                                <asp:Image ID="Image2" runat="server" ImageUrl="~/Images/botones/expand.jpg" AlternateText="(Mostrar detalle...)" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
                <asp:Panel ID="pnlReqBody" runat="server" Width="100%">
                    <table cellspacing="2" cellpadding="2" border="0" width="100%">
                        <tr>
                            <td align="center">
                                <table cellpadding="0" cellspacing="0" border="0" align="center">
                                    <tr>
                                        <td align="right">
                                            Descripción requisito :
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtDescripcionReq" runat="server" ValidationGroup="agregarReq" Width="200px"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtDescripcionReq"
                                                ErrorMessage="Ingrese la descripción." ValidationGroup="agregarReq">*</asp:RequiredFieldValidator>
                                        </td>
                                        <td>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            Cantidad :
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtCantidad" runat="server" ValidationGroup="agregarReq" Width="80px"></asp:TextBox>
                                            <asp:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" Enabled="True"
                                                FilterType="Numbers" TargetControlID="txtCantidad">
                                            </asp:FilteredTextBoxExtender>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtCantidad"
                                                ErrorMessage="Ingrese la cantidad." ValidationGroup="agregarReq">*</asp:RequiredFieldValidator>
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            &nbsp;
                                        </td>
                                        <td align="right">
                                            <asp:Button ID="btnAgregarReq" runat="server" OnClick="btnAgregarReq_Click" Text="Agregar Requisito"
                                                ValidationGroup="agregarReq" />
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                </table>
                                <asp:UpdatePanel ID="upnlReq" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <asp:GridView ID="grvReq" runat="server" BackColor="White" AutoGenerateColumns="False"
                                            BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" OnRowDataBound="grvReq_RowDataBound"
                                            DataKeyNames="IdRequisito,IdEspectaculo">
                                            <Columns>
                                                <asp:BoundField DataField="Descripcion" HeaderText="Descripcioón" />
                                                <asp:BoundField DataField="Cantidad" HeaderText="Cantidad" />
                                                <asp:TemplateField>
                                                    <ItemTemplate>
                                                        <asp:ImageButton ID="ibtnEliminarReq" runat="server" ImageUrl="~/Images/botones/filedelete.gif"
                                                            OnClick="ibtnEliminarReq_Click" />
                                                        <asp:ConfirmButtonExtender ID="ibtnEliminarReq_ConfirmButtonExtender" runat="server"
                                                            ConfirmText="Está seguro de eliminar el registro?" Enabled="True" TargetControlID="ibtnEliminarReq">
                                                        </asp:ConfirmButtonExtender>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                            </Columns>
                                            <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
                                            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
                                            <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                                            <RowStyle BackColor="White" ForeColor="#330099" />
                                            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
                                            <SortedAscendingCellStyle BackColor="#FEFCEB" />
                                            <SortedAscendingHeaderStyle BackColor="#AF0101" />
                                            <SortedDescendingCellStyle BackColor="#F6F0C0" />
                                            <SortedDescendingHeaderStyle BackColor="#7E0000" />
                                        </asp:GridView>
                                    </ContentTemplate>
                                    <Triggers>
                                        <asp:AsyncPostBackTrigger ControlID="btnAgregarReq" EventName="Click" />
                                        <asp:AsyncPostBackTrigger ControlID="grvReq" EventName="RowCommand" />
                                    </Triggers>
                                </asp:UpdatePanel>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
                <asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server" TargetControlID="pnlReqBody"
                    ExpandControlID="pnlReq" CollapseControlID="pnlReq" Collapsed="True" TextLabelID="Label2"
                    ImageControlID="Image2" ExpandedText="(Ocultar...)" CollapsedText="(Mostrar...)"
                    CollapsedImage="~/Images/Botones/expand.jpg" ExpandedImage="~/Images/Botones/collapse.jpg"
                    SuppressPostBack="true" BehaviorID="pnlReqBody">
                </asp:CollapsiblePanelExtender>
                <br />
            </td>
        </tr>
    </table>
    <asp:ModalPopupExtender ID="mpeProgView" runat="server" CancelControlID="btnCancel" 
        TargetControlID="Button1" PopupControlID="pnlView" PopupDragHandleControlID="PopupHeader"
        Drag="true" BackgroundCssClass="ModalPopupBG">
    </asp:ModalPopupExtender>
    <asp:Panel ID="pnlView" Style="display:none" runat="server">
        <div class="HellowWorldPopup">
            <div class="popup_Titlebar" id="PopupHeader">
                <div class="TitlebarLeft">
                    <asp:Label ID="lblTitulo" runat="server" Style="font: bold; color: White;" Text="Buscar Artista"></asp:Label>
                </div>
                <div class="TitlebarRight" onclick="$get('btnCancel').click();">
                </div>
            </div>
            <br />
                    <table align="center" >
                      <tr>
                     <td  align="right">Nombre  :</td>
                     <td>
                          <asp:TextBox ID="txtNombreArtista" runat="server"></asp:TextBox></td>
                     <td></td>
                     </tr> 
                        <tr>
                            
                            <td align="right">
                                Tipo Espectáculo :
                            </td>
                            <td align="left">
                                <asp:DropDownList ID="ddlTipo" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlTipo_SelectedIndexChanged" />
                            </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                Subtipo Espectáculo :
                            </td>
                            <td align="left">
                             <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                                <asp:DropDownList ID="ddlSubtipo" runat="server" />
                                    </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="ddlTipo" EventName="SelectedIndexChanged" />
                                </Triggers>
                            </asp:UpdatePanel>
                            </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                Representante :
                            </td>
                            <td align="left">
                                <asp:DropDownList ID="ddlRepresentante" runat="server"  />
                            </td>
                            <td>
                                <asp:Button ID="btnBuscar" runat="server" Text="Buscar Artista" 
                                onclick="btnBuscar_Click" />

                                 <asp:ImageButton ID="ibtnReset" runat="server" Text="Restablecer" 
                                onclick="imgBuscarArtista_Click" ImageUrl="~/Espectaculos/Images/botones/recycle.png" />
                            </td>
                        </tr>
                        <tr>
                            <td align="center" colspan="3">
                             <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <asp:GridView ID="grvArts" runat="server" BackColor="White" AutoGenerateColumns="False"
                                        BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" OnRowDataBound="grvArts_RowDataBound" 
                                        EmptyDataText="No se encontraron registros."      DataKeyNames="IdArtista">
                                        <Columns>
                                            <asp:TemplateField HeaderText="Artista">
                                                <ItemTemplate >
                                                    <asp:LinkButton ID="lnkArtista" runat="server" > </asp:LinkButton>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:BoundField DataField="Tipo" HeaderText="Tipo" />
                                            <asp:BoundField DataField="SubTipo" HeaderText="Género" />
                                            <asp:BoundField DataField="Representante" HeaderText="Representante" />
                                           
                                        </Columns>
                                        <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
                                        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
                                        <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                                        <RowStyle BackColor="White" ForeColor="#330099" />
                                        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
                                        <SortedAscendingCellStyle BackColor="#FEFCEB" />
                                        <SortedAscendingHeaderStyle BackColor="#AF0101" />
                                        <SortedDescendingCellStyle BackColor="#F6F0C0" />
                                        <SortedDescendingHeaderStyle BackColor="#7E0000" />
                                    </asp:GridView>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="btnBuscar" EventName="Click" />
                                    <asp:AsyncPostBackTrigger ControlID="imgBuscarArtista" EventName="Click" />
                                    <asp:AsyncPostBackTrigger ControlID="ibtnReset" EventName="Click" />
                                </Triggers>
                            </asp:UpdatePanel>
                            </td>
                        </tr>
                    </table>
              
            <div class="popup_Buttons" align="center">
                <input id="btnCancel" type="button" value="Cancelar" />
            </div>
            
        </div>
    </asp:Panel>
     <div style="display:none">
                 <asp:Button ID="Button1" runat="server" Text="ver" />
            </div>

    <script language="javascript" type="text/javascript">
        function resetControl() {

            document.getElementById('<%=txtNombreArtista.ClientID%>').value = '';
            document.getElementById('<%=ddlRepresentante.ClientID%>').value = '-1';
            document.getElementById('<%=ddlTipo.ClientID%>').value = '-1';
            document.getElementById('<%=ddlSubtipo.ClientID%>').value = '-1';
        }

        function seleccionarArtista(nombre, id) {
            document.getElementById('<%=txtArtista.ClientID%>').value = nombre;
            document.getElementById('<%=hdIdArtista.ClientID%>').value = id;

            $find('<%=mpeProgView.ClientID%>').hide();
        }

        function resetControlArtista() {
            document.getElementById('<%=txtDuracion.ClientID%>').value = '';
            document.getElementById('<%=ddlMinuto.ClientID%>').value = '00';
            document.getElementById('<%=ddlHora.ClientID%>').value = '00';
            document.getElementById('<%=txtArtista.ClientID%>').value = '';
            document.getElementById('<%=hdIdArtista.ClientID%>').value = '';
        }

        function resetControlReq() {
            document.getElementById('<%=txtCantidad.ClientID%>').value = '';
            document.getElementById('<%=txtDescripcionReq.ClientID%>').value = '';
            
        }

    </script>
</asp:Content>
